package orz.xuchao.javapatterns.iterator;
/**
 * 迭代器模式
 */
public class TestIterator {
	 public static void  test(){
	        Object[] objArray = {"One","Two","Three","Four","Five","Six"};
	        //创建聚合对象
	        Aggregate agg = new ConcreteAggregate(objArray);
	        //循环输出聚合对象中的值
	        Iterator it = agg.createIterator();
	        while(!it.isDone()){
	            System.out.println(it.currentItem());
	            it.next();
	        }
	    }

}
